|
1
|
|
|
|
|
2
|
|
|
const Router = require('koa-router')(); |
|
3
|
|
|
const CateringPermissions = require('../../catering_permissions') |
|
4
|
|
|
const Session = require('../../controller/catering/session') |
|
5
|
|
|
const Customer = require('../../controller/catering/customer') |
|
6
|
|
|
const Audit = require('../../controller/catering/audit') |
|
7
|
|
|
const Store = require('../../controller/catering/store') |
|
8
|
|
|
const Category = require('../../controller/catering/category') |
|
9
|
|
|
|
|
10
|
|
|
module.exports = function () { |
|
11
|
|
|
/** |
|
12
|
|
|
* 用户微信登陆 |
|
13
|
|
|
*/ |
|
14
|
|
|
Router.post('/api/catering/v1/sessions', CateringPermissions('guest'), Session.wxLogin) |
|
15
|
|
|
|
|
16
|
|
|
// 用户信息 |
|
17
|
|
|
Router.get('/api/catering/v1/customers/:uid', CateringPermissions('user'), Customer.detail) |
|
18
|
|
|
// 编辑用户 |
|
19
|
|
|
Router.put('/api/catering/v1/customers/:uid', CateringPermissions('user'), Customer.edit) |
|
20
|
|
|
|
|
21
|
|
|
// 申请开通店铺 |
|
22
|
|
|
Router.post('/api/catering/v1/customers/:uid/sellers', CateringPermissions('user'), Customer.applySeller) |
|
23
|
|
|
|
|
24
|
|
|
// 统一图片处理 |
|
25
|
|
|
Router.post('/api/catering/v1/customers/:uid/oss', CateringPermissions('user'), Customer.oss) |
|
26
|
|
|
|
|
27
|
|
|
// 小程序码 |
|
28
|
|
|
Router.post('/api/catering/v1/customers/:uid/mina_qrcodes', CateringPermissions('user'), Customer.minaQRcode) |
|
29
|
|
|
|
|
30
|
|
|
// 审核商家 |
|
31
|
|
|
Router.post('/api/catering/v1/audits/:uid/sellers/:sellerId', CateringPermissions('audit'), Audit.seller) |
|
32
|
|
|
|
|
33
|
|
|
// 商店信息 |
|
34
|
|
|
Router.get('/api/catering/v1/stores/:storeId', CateringPermissions('store'), Store.detail) |
|
35
|
|
|
|
|
36
|
|
|
// 商店分类 |
|
37
|
|
|
Router.get('/api/catering/v1/stores/:storeId/categories', CateringPermissions('store'), Category.index) |
|
38
|
|
|
Router.post('/api/catering/v1/stores/:storeId/categories', CateringPermissions('store'), Category.add) |
|
39
|
|
|
Router.get('/api/catering/v1/stores/:storeId/categories/:categoryId', CateringPermissions('store'), Category.detail) |
|
40
|
|
|
Router.put('/api/catering/v1/stores/:storeId/categories/:categoryId', CateringPermissions('store'), Category.edit) |
|
41
|
|
|
Router.delete('/api/catering/v1/stores/:storeId/categories/:categoryId', CateringPermissions('store'), Category.delete) |
|
42
|
|
|
|
|
43
|
|
|
return Router; |
|
44
|
|
|
} |